﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling;

namespace CustomsNuke.Engine.CustomsException
{
    public class CustomsExceptionManager
    {
        public static void HandleException(Exception ex, ExceptionType exceptionType)
        {
            var exManager = EnterpriseLibraryContainer.Current.GetInstance<ExceptionManager>();
            
            switch (exceptionType)
            {
                case ExceptionType.NewthrowException:
                    exManager.HandleException(ex, "Newthrow");
                    break;
                case ExceptionType.NothrowException:
                    exManager.HandleException(ex, "Nothrow");
                    break;
                case ExceptionType.RethrowException:
                    exManager.HandleException(ex, "Rethrow");
                    break;
                default:
                    exManager.HandleException(ex, "Rethrow");
                    break;
            }
        }
    }
    public enum ExceptionType
    {
        NothrowException,
        RethrowException,
        NewthrowException
    }
}
